package org.example.controller;

import org.apache.ibatis.annotations.Param;
import org.example.domain.NitChat;
import org.example.service.impl.NitChatServiceImpl;
import org.example.untils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("nitChat")
public class NitChatController {

    @Autowired
    private NitChatServiceImpl nitChatServiceImpl;

    @PostMapping("/insertOneNitChat")
    public Result insertOneNitChat(@RequestBody NitChat nitChat){
        nitChatServiceImpl.insertOneNitChat(nitChat);
        return new Result();
    }

    @GetMapping("/selectNitChatsByNitRecordId")
    public Result selectNitChatsByNitRecordId(@Param("nitRecordId") Integer nitRecordId){
        NitChat[] nitChats= nitChatServiceImpl.selectNitChatsByNitRecordId(nitRecordId);
        return new Result(200,"获取成功",nitChats);
    }

}
